<link rel="stylesheet" href="../addons/jy_newping/resource/css/style.css" />
<style type="text/css">
.order_goods_img img {border: 1px solid rgb(215, 215, 215); border-image: none; width: 60px; height: 60px; display: block;}
.order_goods_price i {font-size: 9px;}
.order_goods_grab .order_goods_grab_txt {background: 0px 0px rgb(238, 51, 17); padding: 2px 3px; border-radius: 2px; color: rgb(255, 255, 255); display: inline-block;}
.tuan_g_price b {font-size: 18px; font-weight: 400; margin-right: 2px; margin-left: 5px;}
.tuan_g_price span {vertical-align: 1px;}
.order_status {height: 30px; color: rgb(221, 0, 0); line-height: 40px; float: left;}
.order_btn a {border-radius: 3px; width: 80px; height: 30px; text-align: center; color: rgb(255, 255, 255); line-height: 30px; margin-left: 5px; float: left; background-color: rgb(75, 75, 75); -webkit-border-radius: 3px;
}
#container{margin:0;background: none;}
.fui-list-angle span.text-danger{color: #ef4f4f;}
</style>
<div class='fui-page order-list-page'>
	<div class="jy2-headertopbg">
			<div class="fui-header" style="background:none">
				<div class="fui-header-left">
					<a class="back" style="color:#fff" href="javascript:" ng-click="goback()"></a>
				</div>
				<div class="title bold" style="font-size:1rem;color:#fff">参与的拼单</div>
			</div>
	 </div>
	<div class="fui-tab fui-tab-danger jy2-headertop" id="tab" style="top:4.2rem">
		<a ng-class="{'external active':pagedata.params.status == 100}" href="javascript:" ng-click="pagedata.params.status=100;tool.get_list('jy_newping/myteam/getorder/',true);">全部拼单</a>
		<a ng-class="{'external active':pagedata.params.status == 10}" href="javascript:" ng-click="pagedata.params.status=10;tool.get_list('jy_newping/myteam/getorder/',true);">拼单中</a>
        
		<a ng-class="{'external active':pagedata.params.status == 2}" href="javascript:" ng-click="pagedata.params.status=2;tool.get_list('jy_newping/myteam/getorder/',true);">拼单成功</a>
        <a ng-class="{'external active':pagedata.params.status == 1}" href="javascript:" ng-click="pagedata.params.status=1;tool.get_list('jy_newping/myteam/getorder/',true);">待收货</a>
		<a ng-class="{'external active':pagedata.params.status == 5}" href="javascript:" ng-click="pagedata.params.status=5;tool.get_list('jy_newping/myteam/getorder/',true);">拼单失败</a>
	</div>
    <div class='fui-content' style="padding-bottom:0;top:4.8rem;position: absolute;">
		<div class='fui-content-inner' ng-if="!pagedata.list || pagedata.list.length==0">
			<div class='content-empty'>
				<i class='icon icon-lights'></i><br/>暂时没有参加任何拼单
			</div>
			<div class="fui-according-group" id="container"></div>
		</div>
		<div ng-repeat="item in pagedata.list" class='lynn_order_item'>
			<div class="external">
				<div class='lynn_order_title'>
					订单号: {{item.ordersn}}
					<span ng-if="item.teamid==0 || item.status==0" class="order_status" style="float:right;"> 还未开拼 </span>
					<span ng-if="item.status==4 || item.status==-1" class="order_status" style="float:right;"> 已取消 </span>
					<span ng-if="item.status==1 || item.status==2 || item.status==3" class="order_status" style="float:right;"> 拼单已成功 </span>
					<span ng-if="item.status==5 || item.status==6" class="order_status" style="float:right;"> 拼单失败 </span>
					<span ng-if="item.status==10 && item.teamid && item.team.status==0" class="order_status" style="float:right;"> 拼单进行中 </span>
					<span ng-if="item.team.status==3" class="order_status" style="float:right;"> 拼单已过期 </span>
				</div>
				<div class="fui-list lynn_order_list" style="background:#fff">
					<div class="fui-list-media">
						<img ng-src="{{tomedia(item.goods.image) || '../core/resource/images/nopic.jpg'}}" class="round">
					</div>
					<div class="fui-list-inner">
						<div class="lynn_order_list_title" style="height:auto">{{item.goods.title}}</div>
						<div class="subtitle">{{item.goods.subtitle || '无商品描述！'}}</div>
						<div ng-if="item.status==0" class="subtitle" style="color:red">还有￥{{item.goods.fan_price || 0.00}}待返，赶快来拼单吧！</div>
					</div>
					<div class='fui-list-angle' style="width:auto">
						<span class='marketprice text-danger'>¥{{item.goods.groupprice}}</span>/{{item.unit||'件'}}<br/>
						x1
					</div>
					<div style="position: absolute;right: 4rem;top:3px;width:3rem;height: 3rem;z-index: 10;">
						<img ng-if="item.status==10" alt="" width="100%" height="100%" src="/addons/jy_newping/resource/images/frightin.png"/>
						<img ng-if="item.status==1 || item.status==2 || item.status==3" alt="" width="100%" height="100%" src="/addons/jy_newping/resource/images/success.png"/>
						<img ng-if="item.status==5 || item.status==6" alt="" width="100%" height="100%" src="/addons/jy_newping/resource/images/fail.png"/>
					</div>
				</div>
				<div class='lynn_order_price'>
					<span class='status'>
						运费: <span class='text-danger'>¥{{item.dispatchprice || '0.00'}}</span>元, 共 <span class='text-danger'>1</span> 个商品
						总额: <span class='text-danger'>¥{{item.price}}</span>元
					</span>
					<span class='r-f'>{{item.createtime}}</span>
				</div>
			</div>
			<div class='lynn_order_bottom' style="height:auto">
				<span class="status">
					<a ng-if="item.addressid==0 && item.status==1" class="lynn_btn lynn_btn_danger" href="javascript:;" ng-click="pagedata.setaddress(item.id);">补收货地址</a>
					<a ng-if="item.team.status==1" class="lynn_btn lynn_btn_danger" href="javascript:;" ng-click="access_json('jy_newping/goods.detail//id='+item.goodsid)">再拼一单</a>
					<a ng-if="item.teamid" class="external lynn_btn lynn_btn_danger" href="javascript:;" ng-click="access_json('jy_newping/teamdetail/detail/teamid='+item.teamid)">查看拼单详情</a>
					<a ng-if="item.status==0" class="external lynn_btn lynn_btn_danger" href="javascript:;" ng-click="pay_submit({},'jy_newping/myteam/pay/id='+item.id,'jy_newping/myteam/','jy_newping/myteam/')">支付发起拼单</a>
					<a ng-show="item.can_cancel" class="btn btn-sm btn-default-o order-delete" style="line-height:1.8;" href="javascript:;" ng-click="post({id:item.id},'jy_newping/myteam/cancel/','id='+item.id)">取消订单</a>
					<a ng-show="item.can_refund==1" class="btn btn-sm btn-default-o order-finish" style="line-height:1.8;" href="javascript:;" ng-click="access_json('jy_weishop/order.refund/apply/orderid='+item.id)">申请退款</a>
					<a ng-show="item.can_refund==2" class="btn btn-sm btn-default-o order-finish" style="line-height:1.8;" href="javascript:;" ng-click="access_json('jy_weishop/order.refund/apply/orderid='+item.id)">申请售后</a>
				</span>
			</div>
		</div>
	 </div>
</div>
<div id="modal_address"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0">
	<div class="modal-bottom">
		<div ng-if="pagedata.isadd_address!=1" class="fui-content" style="background:#fff">
			<div class="fui-cell-title text-center">送至</div>
			<div ng-if="pagedata.address_list.length" class="fui-list-group address-item modal-swiper-y">
				<div class="fui-list" ng-repeat="item in pagedata.address_list">
					<div class="fui-list-inner">
						<div class="title red"><span class='realname'>{{item.name}}</span> <span class='mobile'>{{item.mobile}}</span></div>
						<div class="text red"><span class='address'>{{item.pcd.province}}&nbsp{{item.pcd.city}}&nbsp{{item.pcd.district}}&nbsp{{item.address}}</span></div>
					</div>
					<div class='fui-list-angle'>
                        <label class='radio-inline'>
							<input type="radio" class="fui-radio  fui-radio-danger" ng-checked="pagedata.post.addressid == item.id" ng-click="pagedata.change_address(item.id)"/>
						</label>
                    </div>
				</div>
			</div>
			<div ng-if="!pagedata.address_list.length" class='content-empty' style="margin:0">
				<i class='icon jinyunicon icon-search'></i><br/> 您还没有地址？~ 添加一个吧 ~<br/><a ng-click="pagedata.isadd_address=1" class='btn btn-sm btn-default-o external'>添加地址</a>
			</div>
			<div ng-if="pagedata.address_list.length" class="fui-navbar">
				<a href="javascript:;" ng-click="pagedata.set_address();" aria-hidden="true" data-dismiss="modal" class="nav-item btn btn-danger confirmbtn">确定</a>
			</div>
		</div>
		<div ng-if="pagedata.isadd_address==1" class="fui-content" style="background:#fff">
			<div class="fui-cell-title text-center">添加地址</div>
			<div class='fui-cell-group'>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>收件人</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.address.name" placeholder="收件人" class="fui-input"/></div>
                </div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>联系电话</div>
                    <div class='fui-cell-info'><input type="tel" ng-model="pagedata.address.mobile" placeholder="联系电话"  class="fui-input"/></div>
                </div>

                <div class="fui-cell">
					<div class="fui-cell-label ">地区</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.address.pcd.province" class="form-control tpl-province">
						<option value="" selected="selected">省份</option>
						<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="pagedata.address.pcd.province==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.address.pcd.city" class="form-control tpl-city">
						<option value="" selected="selected">城市</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.address.pcd.province]" value="{{value}}" ng-selected="pagedata.address.pcd.city==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.address.pcd.district" class="form-control tpl-district">
						<option value="" selected="selected">区县</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.address.pcd.province][pagedata.address.pcd.city]" value="{{value}}" ng-selected="pagedata.address.pcd.district==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.address.pcd.street" class="form-control tpl-district">
						<option value="" selected="selected">街道</option>
						<option ng-repeat="value in pagedata.province[pagedata.address.pcd.province][pagedata.address.pcd.city][pagedata.address.pcd.district]" value="{{value}}" ng-selected="pagedata.address.pcd.street==value">{{value}}</option>
						</select>
					</div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>详细地址</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.address.address" placeholder='街道，楼牌号等'  class="fui-input"/></div>
                </div>
            </div>
			<div class="fui-navbar">
				<a ng-click="pagedata.add_address();" class="nav-item btn btn-danger confirmbtn">确定</a>
			</div>
		</div>
	</div>
	</div>
</div>
<div ng-include="sys_html('common/pluginnav',true)"></div>
<div ng-include="sys_html('_footer')"></div>
<script>
scope.loading = true;  //状态标记
scope.isnodata = false;
//滚动加载
scope.tool.get_list('jy_newping/myteam/getorder/',true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list('jy_newping/myteam/getorder/');
}
scope.pagedata.setaddress=function(id){
	scope.pagedata.orderid=id;
	$('#modal_address').modal();
}
scope.pagedata.add_address=function(){
	scope.pagedata.address.res=1
	scope.post_json('core/member.address/post/',scope.pagedata.address,function(res){
			scope.pagedata.post.addressid =res;
			$('#modal_address').modal('hide');
			scope.$evalAsync();
	});
}
//选择地址
scope.pagedata.change_address=function(id){
	scope.pagedata.addressid=id
}
//选择地址
scope.pagedata.set_address=function(){
	scope.post_json('jy_newping/myteam/set_address/',{'id':scope.pagedata.orderid,'addressid':scope.pagedata.addressid},function(res){
			
	});
}
</script>